package wiki.generic.concreteutilities;

import java.io.File;
import java.util.StringTokenizer;

import wiki.generic.utilities.FileNamesManager;

/**
 * 
 * @author <p><strong>JwTeam</strong></p> 
 *
 */

public class ConcreteFileNamesManager implements FileNamesManager {

	public boolean isDuplicate(String dest,String fileName){
		File f=new File(dest);
		File[] files=f.listFiles();
		boolean duplicate=false;
		
		for (int i = 0; i < files.length; i++) {
			if(files[i].getName().equals(fileName)){
				duplicate=true;
			}
		}
		return duplicate;
	}
	
	public String modifyName(String fileName){
			StringTokenizer tok=new StringTokenizer(fileName,".");
			String sub1=tok.nextToken();
			String ext=tok.nextToken();
			fileName=sub1+"0."+ext;
			return fileName;
	
	}
}
